import React,{ Component } from 'react';
import { CommonBlock } from '../../../component/home/main/hot/hotData/CommonBlock'
import  JobItem  from '../../../component/home/main/hot/hotData/JobItem'
import  {NoticCard}  from '../../../component/home/main/hot/hotData/NoticCard'
import '../../../style/pages/MuluBlock.less'
class MuluBlock extends Component{

    constructor(props){
        super(props)
        this.state={
            muludata:[]
        }
    }

    componentDidMount(){
        const data={
            code:'200',
            rows:[
                { 'name':'','type':1,'row':[
                        [{'id':1,'name':'信用服务','bgClass':'','tuClass':'iconbum','url':'xinyongfuwu'},
                            {'id':2,'name':'医疗卫生','bgClass':'','tuClass':'iconbum','url':'yiliaoweisheng'},
                            {'id':3,'name':'社保就业','bgClass':'','tuClass':'iconbum','url':'shebaojiuye'},
                        ],
                        [{'id':4,'name':'公共安全','bgClass':'','tuClass':'iconbum','url':'gonggonganquan'},
                            {'id':5,'name':'城建住房','bgClass':'icnGreen','tuClass':'iconbum','url':'chengjianzhufang'},
                            {'id':6,'name':'交通运输','bgClass':'','tuClass':'iconbum','url':'jiaotongyunshu'},
                        ]
                    ]
                },
                {'name':'数字化转型','type':4,'row':[
                    {'id':1,'title':'"一证通办"人口数据申请','footer':'张琛 ','time':'2019-08-02',tu:'../../../../../image/timg.jpg'},
                    {'id':2,'title':'"一证通办"人口数据申请','footer':'张琛 ','time':'2019-08-02',tu:'../../../../../image/timg.jpg'},
                    {'id':3,'title':'"一证通办"人口数据申请','footer':'张琛 ','time':'2019-07-25',tu:'../../../../../image/timg.jpg'}
                ]},
            ]
        }
        const muludatas = data.rows.map((obj) => 
            <CommonBlock blockName={obj.name} key={obj.name}>
                {
                    obj.type === 1 ?
                        <div >
                            {obj.row.map((son) => 
                                <JobItem key={son[0].id} job={son}></JobItem>
                            )}
                        </div>
                    : 
                        <div style={{marginTop:"10px"}} >
                                {obj.row.map((son) => 
                                    <NoticCard key={son.id} notice={son}></NoticCard>
                                )}
                        </div>
                    
                }
            </CommonBlock>
        ); 
        this.setState({muludata:muludatas});
    }
    render (){
        return (
            <div className='mulublock'>
                {this.state.muludata}
            </div>
        )
    }
}
export {MuluBlock}